import {
  createApp,
  ref,
  watch,
} from "../node_modules/vue/dist/vue.esm-browser.js";

createApp({
  setup() {
    const question = ref("");
    const answer = ref("");
    watch(question, async (newVal, oldVal) => {
      const res = await fetch("https://www.yesno.wtf/api");
      const data = await res.json();
      answer.value = data.answer;
    });
    return {
      question,
      answer,
    };
  },
}).mount("#app");
